<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Low-level utility to query EJScreen API for one circular buffer — ejscreenRESTbroker • EJAM</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.4.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.4.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Low-level utility to query EJScreen API for one circular buffer — ejscreenRESTbroker"><meta name="description" content="Use EJScreen API to get raw json-format response, ready to be
parsed by ejscreenRESTbroker2table(). This function underlies higher level
functions like ejscreenapi() and overall ejscreenit()"><meta property="og:description" content="Use EJScreen API to get raw json-format response, ready to be
parsed by ejscreenRESTbroker2table(). This function underlies higher level
functions like ejscreenapi() and overall ejscreenit()"><meta property="og:image" content="https://usepa.github.io/EJAM/logo.svg"></head><body>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>


    <nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">

    <a class="navbar-brand me-2" href="../index.html">EJAM</a>

    <small class="nav-text text-warning me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Released version">2.32.0</small>


    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div id="navbar" class="collapse navbar-collapse ms-3">
      <ul class="navbar-nav me-auto"><li class="active nav-item"><a class="nav-link" href="../reference/index.html">Reference</a></li>
<li class="nav-item dropdown">
  <button class="nav-link dropdown-toggle" type="button" id="dropdown-articles" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true">Articles</button>
  <ul class="dropdown-menu" aria-labelledby="dropdown-articles"><li><hr class="dropdown-divider"></li>
    <li><h6 class="dropdown-header" data-toc-skip>Overview for EJAM Users</h6></li>
    <li><a class="dropdown-item" href="../articles/0_whatis.html">What is EJAM</a></li>
    <li><a class="dropdown-item" href="../articles/0_webapp.html">Using EJAM</a></li>
    <li><hr class="dropdown-divider"></li>
    <li><h6 class="dropdown-header" data-toc-skip>For analysts using R</h6></li>
    <li><a class="dropdown-item" href="../articles/1_installing.html">Installing the EJAM R package</a></li>
    <li><a class="dropdown-item" href="../articles/2_quickstart.html">Quick Start Guide</a></li>
    <li><a class="dropdown-item" href="../articles/3_analyzing.html">Basics of Using EJAM for Analysis in RStudio</a></li>
    <li><a class="dropdown-item" href="../articles/4_advanced.html">Advanced Features</a></li>
  </ul></li>
<li class="nav-item"><a class="nav-link" href="../news/index.html">Changelog</a></li>
      </ul><ul class="navbar-nav"><li class="nav-item"><form class="form-inline" role="search">
 <input class="form-control" type="search" name="search-input" id="search-input" autocomplete="off" aria-label="Search site" placeholder="Search for" data-search-index="../search.json"></form></li>
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/USEPA/EJAM/" aria-label="GitHub"><span class="fa fab fa-github fa-lg"></span></a></li>
      </ul></div>


  </div>
</nav><div class="container template-reference-topic">
<div class="row">
  <main id="main" class="col-md-9"><div class="page-header">
      <img src="../logo.svg" class="logo" alt=""><h1>Low-level utility to query EJScreen API for one circular buffer</h1>
      <small class="dont-index">Source: <a href="https://github.com/USEPA/EJAM/blob/HEAD/R/ejscreenRESTbroker.R" class="external-link"><code>R/ejscreenRESTbroker.R</code></a></small>
      <div class="d-none name"><code>ejscreenRESTbroker.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>Use EJScreen API to get raw json-format response, ready to be
parsed by <code><a href="ejscreenRESTbroker2table.html">ejscreenRESTbroker2table()</a></code>. This function underlies higher level
functions like <code><a href="ejscreenapi.html">ejscreenapi()</a></code> and overall <code><a href="ejscreenit.html">ejscreenit()</a></code></p>
    </div>

    <div class="section level2">
    <h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">ejscreenRESTbroker</span><span class="op">(</span></span>
<span>  lon <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  lat <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  radius <span class="op">=</span> <span class="fl">3</span>,</span>
<span>  fips <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  namestr <span class="op">=</span> <span class="st">""</span>,</span>
<span>  shapefile <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  url <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"https://ejscreen.epa.gov/mapper/ejscreenRESTbroker1.aspx?"</span>,</span>
<span>    <span class="st">"https://ejscreen.epa.gov/mapper/ejscreenRESTbroker.aspx?"</span><span class="op">)</span><span class="op">[</span><span class="fl">1</span><span class="op">]</span>,</span>
<span>  ipurl <span class="op">=</span> <span class="st">"ejscreen.epa.gov"</span>,</span>
<span>  wkid <span class="op">=</span> <span class="fl">4326</span>,</span>
<span>  unit <span class="op">=</span> <span class="fl">9035</span>,</span>
<span>  f <span class="op">=</span> <span class="st">"pjson"</span>,</span>
<span>  reportstyle <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"EJscreen_SOE_report"</span>, <span class="st">"EJSCREEN_report"</span><span class="op">)</span><span class="op">[</span><span class="fl">1</span><span class="op">]</span></span>
<span><span class="op">)</span></span></code></pre></div>
    </div>

    <div class="section level2">
    <h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>


<dl><dt id="arg-lon">lon<a class="anchor" aria-label="anchor" href="#arg-lon"></a></dt>
<dd><p>a longitude</p></dd>


<dt id="arg-lat">lat<a class="anchor" aria-label="anchor" href="#arg-lat"></a></dt>
<dd><p>a latitude</p></dd>


<dt id="arg-radius">radius<a class="anchor" aria-label="anchor" href="#arg-radius"></a></dt>
<dd><p>radius of the circular buffer (normally in miles)</p></dd>


<dt id="arg-fips">fips<a class="anchor" aria-label="anchor" href="#arg-fips"></a></dt>
<dd><p>If specified, lon and lat are ignored, and the one fips code must be the
FIPS code of a blockgroup or tract, or county (5 digits with leading zero)
or city/town/cdp/etc. (7 digits with leading zero).
A character string is best, with leading zero if relevant.</p></dd>


<dt id="arg-namestr">namestr<a class="anchor" aria-label="anchor" href="#arg-namestr"></a></dt>
<dd><p>optional text</p></dd>


<dt id="arg-shapefile">shapefile<a class="anchor" aria-label="anchor" href="#arg-shapefile"></a></dt>
<dd><p>not implemented</p></dd>


<dt id="arg-url">url<a class="anchor" aria-label="anchor" href="#arg-url"></a></dt>
<dd><p>URL base for API (provides access to the shorter version vs default longer list of indicators),
where newer 2023 version is default, using ejscreenRESTbroker1.aspx,
and old style/mini version is at ejscreenRESTbroker.aspx</p></dd>


<dt id="arg-ipurl">ipurl<a class="anchor" aria-label="anchor" href="#arg-ipurl"></a></dt>
<dd><p>fixed ip or domain/URL to try</p></dd>


<dt id="arg-wkid">wkid<a class="anchor" aria-label="anchor" href="#arg-wkid"></a></dt>
<dd><p>spatial reference. https://epsg.io/4326</p></dd>


<dt id="arg-unit">unit<a class="anchor" aria-label="anchor" href="#arg-unit"></a></dt>
<dd><p>9035 for miles, 9036 for kilometers, but default is miles</p></dd>


<dt id="arg-f">f<a class="anchor" aria-label="anchor" href="#arg-f"></a></dt>
<dd><p>pjson for results in JSON format, or report for the URL of the pdf report</p></dd>


<dt id="arg-reportstyle">reportstyle<a class="anchor" aria-label="anchor" href="#arg-reportstyle"></a></dt>
<dd><p>EJscreen_SOE_report for the full community profile that was new as of 7/2023,
or EJSCREEN_report for the older style standard report (which has fewer indicators on it).</p></dd>

</dl></div>
    <div class="section level2">
    <h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
    <p>Returns JSON by default. See source code of this function for notes on format.
status_code</p>
    </div>
    <div class="section level2">
    <h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
    <p>Note the public and internal IP addresses differ.</p>
<p>See <a href="https://ejscreen.epa.gov/mapper/ejscreenRESTbroker1.aspx?geometry=%7B%22spatialReference%22:%7B%22wkid%22:4326%7D,%22x%22:-100.2,%22y%22:36%7D&amp;distance=1&amp;unit=9035&amp;f=json" class="external-link">https://ejscreen.epa.gov/mapper/ejscreenRESTbroker1.aspx?geometry={%22spatialReference%22:{%22wkid%22:4326},%22x%22:-100.2,%22y%22:36}&amp;distance=1&amp;unit=9035&amp;f=json</a></p>
<p>for example of json output format, or see source code of this function.</p>
<p>See <a href="https://ejscreen.epa.gov/mapper/EJscreen_SOE_report.aspx?namestr=&amp;geometry=%7B%22spatialReference%22:%7B%22wkid%22:4326%7D,%22x%22:-100.12811027526683,%22y%22:36.6582500495267%7D&amp;distance=10&amp;unit=9035&amp;areatype=&amp;areaid=&amp;f=report" class="external-link">https://ejscreen.epa.gov/mapper/EJscreen_SOE_report.aspx?namestr=&amp;geometry={%22spatialReference%22:{%22wkid%22:4326},%22x%22:-100.12811027526683,%22y%22:36.6582500495267}&amp;distance=10&amp;unit=9035&amp;areatype=&amp;areaid=&amp;f=report</a>
for an example of the pdf report output.</p>
<p>Note some variables are duplicated in outputs.</p>
<p>API: Introduction to how the API works:</p><ul><li><p><a href="https://www.epa.gov/ejscreen/ejscreen-api" class="external-link">https://www.epa.gov/ejscreen/ejscreen-api</a></p></li>
</ul><p>API: Simple web interface to try out the API and learn how parameters can be specified in URL:</p><ul><li><p>2023_07         ver 2.2         <a href="https://ejscreen.epa.gov/mapper/ejscreenapi1.html" class="external-link">https://ejscreen.epa.gov/mapper/ejscreenapi1.html</a></p></li>
<li><p>old style/mini ver 2.2 (fewer indicators) <a href="https://ejscreen.epa.gov/mapper/ejscreenapi.html" class="external-link">https://ejscreen.epa.gov/mapper/ejscreenapi.html</a></p></li>
</ul><p>API: REST endpoint:</p><ul><li><p>2023_07  ver 2.2 <a href="https://ejscreen.epa.gov/mapper/ejscreenRESTbroker1.aspx?namestr=" class="external-link">https://ejscreen.epa.gov/mapper/ejscreenRESTbroker1.aspx?namestr=</a></p></li>
<li><p>old style/mini ver 2.2 <a href="https://ejscreen.epa.gov/mapper/ejscreenRESTbroker.aspx?namestr=" class="external-link">https://ejscreen.epa.gov/mapper/ejscreenRESTbroker.aspx?namestr=</a></p></li>
</ul><p>csv/gdb files: Data dictionary for downloadable dataset:</p><ul><li><p>2023_07  ver 2.2 <a href="https://gaftp.epa.gov/EJScreen/2023/EJSCREEN_2023_BG_Columns.xlsx" class="external-link">https://gaftp.epa.gov/EJScreen/2023/EJSCREEN_2023_BG_Columns.xlsx</a></p></li>
</ul><p>API: Data dictionary of variable names:</p><ul><li><p>2023_07  ver 2.2 <a href="https://ejscreen.epa.gov/mapper/ejsoefielddesc1.html" class="external-link">https://ejscreen.epa.gov/mapper/ejsoefielddesc1.html</a></p></li>
<li><p>old style/mini ver 2.2 <a href="https://ejscreen.epa.gov/mapper/ejsoefielddesc.html" class="external-link">https://ejscreen.epa.gov/mapper/ejsoefielddesc.html</a></p></li>
</ul><p>Webpage explaining the indicators</p><ul><li><p>ver 2.2  <a href="https://origin-awswest-www.epa.gov/ejscreen/ejscreen-map-descriptions" class="external-link">https://origin-awswest-www.epa.gov/ejscreen/ejscreen-map-descriptions</a></p></li>
</ul><p>Web tool user guide:</p><ul><li><p>2023_07         ver 2.2 <a href="https://ejscreen.epa.gov/mapper/help/ejscreen_help.pdf" class="external-link">https://ejscreen.epa.gov/mapper/help/ejscreen_help.pdf</a></p></li>
</ul></div>
    <div class="section level2">
    <h2 id="see-also">See also<a class="anchor" aria-label="anchor" href="#see-also"></a></h2>
    <div class="dont-index"><p><code><a href="ejscreenit.html">ejscreenit()</a></code>  or
<code><a href="ejscreenit.html">ejscreenit()</a></code> which use <code><a href="ejscreenapi_plus.html">ejscreenapi_plus()</a></code>
and that uses <code><a href="ejscreenapi.html">ejscreenapi()</a></code> that uses <code><a href="ejscreenapi1.html">ejscreenapi1()</a></code> and <code>ejscreenRESTbroker()</code> and <code><a href="ejscreenRESTbroker2table.html">ejscreenRESTbroker2table()</a></code></p></div>
    </div>

    <div class="section level2">
    <h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="kw">if</span> <span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">{</span> <span class="co"># \dontrun{</span></span>
<span>  <span class="fu"><a href="https://rdrr.io/r/utils/browseURL.html" class="external-link">browseURL</a></span><span class="op">(</span><span class="fu">ejscreenRESTbroker</span><span class="op">(</span>lon <span class="op">=</span> <span class="op">-</span><span class="fl">80</span>, lat <span class="op">=</span> <span class="fl">42</span>, f <span class="op">=</span> <span class="st">'report'</span><span class="op">)</span><span class="op">)</span></span>
<span>  </span>
<span>  <span class="va">x</span> <span class="op">=</span> <span class="fu">ejscreenRESTbroker</span><span class="op">(</span>lon <span class="op">=</span> <span class="op">-</span><span class="fl">80</span>, lat <span class="op">=</span> <span class="fl">42</span><span class="op">)</span> </span>
<span>  <span class="va">df</span> <span class="op">=</span> <span class="fu"><a href="ejscreenRESTbroker2table.html">ejscreenRESTbroker2table</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span></span>
<span>  <span class="fu"><a href="https://rdrr.io/r/base/class.html" class="external-link">class</a></span><span class="op">(</span><span class="va">df</span><span class="op">)</span></span>
<span>  <span class="fu"><a href="https://rdrr.io/r/base/t.html" class="external-link">t</a></span><span class="op">(</span><span class="va">df</span><span class="op">)</span></span>
<span>  </span>
<span>  <span class="va">x</span> <span class="op">=</span> <span class="fu">ejscreenRESTbroker</span><span class="op">(</span>lon <span class="op">=</span> <span class="op">-</span><span class="fl">80</span>, lat <span class="op">=</span> <span class="fl">42</span><span class="op">)</span> </span>
<span>  <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span></span>
<span>  <span class="va">x</span><span class="op">$</span><span class="va">url</span></span>
<span>  <span class="va">x</span><span class="op">$</span><span class="va">status_code</span></span>
<span>  <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">jsonlite</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/jsonlite/man/fromJSON.html" class="external-link">fromJSON</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/rawConversion.html" class="external-link">rawToChar</a></span><span class="op">(</span><span class="va">x</span><span class="op">$</span><span class="va">content</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span>
<span>  <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">jsonlite</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/jsonlite/man/fromJSON.html" class="external-link">fromJSON</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/rawConversion.html" class="external-link">rawToChar</a></span><span class="op">(</span><span class="va">x</span><span class="op">$</span><span class="va">content</span><span class="op">)</span><span class="op">)</span><span class="op">$</span><span class="va">data</span><span class="op">)</span></span>
<span>  <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">jsonlite</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/jsonlite/man/fromJSON.html" class="external-link">fromJSON</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/rawConversion.html" class="external-link">rawToChar</a></span><span class="op">(</span><span class="va">x</span><span class="op">$</span><span class="va">content</span><span class="op">)</span><span class="op">)</span><span class="op">$</span><span class="va">data</span><span class="op">$</span><span class="va">main</span><span class="op">)</span></span>
<span>  <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">jsonlite</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/jsonlite/man/fromJSON.html" class="external-link">fromJSON</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/rawConversion.html" class="external-link">rawToChar</a></span><span class="op">(</span><span class="va">x</span><span class="op">$</span><span class="va">content</span><span class="op">)</span><span class="op">)</span><span class="op">$</span><span class="va">data</span><span class="op">$</span><span class="va">extras</span><span class="op">)</span></span>
<span>  <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="fu">jsonlite</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/jsonlite/man/fromJSON.html" class="external-link">fromJSON</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/rawConversion.html" class="external-link">rawToChar</a></span><span class="op">(</span><span class="va">x</span><span class="op">$</span><span class="va">content</span><span class="op">)</span><span class="op">)</span><span class="op">$</span><span class="va">data</span><span class="op">$</span><span class="va">demographics</span><span class="op">)</span></span>
<span>  <span class="op">}</span> <span class="co"># }</span></span>
<span></span></code></pre></div>
    </div>
  </main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
    </nav></aside></div>


    <footer><div class="pkgdown-footer-left">
  <p>US EPA 2024</p>
</div>

<div class="pkgdown-footer-right">
  <p>EJAM Version 2.32.0</p>
</div>

    </footer></div>





  </body></html>

